package mysql

import "gorm.io/gorm"

type Product struct {
	gorm.Model
	Title  string  `gorm:"type:varchar(30)"`
	Price  float64 `gorm:"type:decimal(10,2)"`
	Number int     `gorm:"type:int(11)"`
	UserId int     `gorm:"type:int(11)"`
}

func (p *Product) FindProductById(db *gorm.DB, id int64) error {
	return db.Debug().Where("id=?", id).Find(p).Error
}

func (p *Product) ProductUpdate(db *gorm.DB) error {
	return db.Debug().Updates(p).Error
}
